package org.example.controller;

import jakarta.annotation.Resource;
import org.example.bean.Student;
import org.example.service.StudentService;
import org.example.util.JsonResult;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther:Liu
 * @Testname:StudentController
 * @Date:2025/9/9 13:34
 */
@RestController
@RequestMapping("/student")
public class StudentController {
    @Resource
    private StudentService studentService;

    @PostMapping("/saveStudent")
    JsonResult SaveStudent(Student student) {
        return studentService.SaveStudent(student);
    }

    @GetMapping("/findById/{id}")
    JsonResult findById(@PathVariable("id") String id){
        return studentService.findStudentById(id);
    }

    @GetMapping("/findByNo/{no}")
    JsonResult findByNo(@PathVariable("no") String no){
        return studentService.findStudentByNo(no);
    }
}
